<?php
/**
 * Created by PhpStorm.
 * User: Celebration-Grey
 * Date: 2017/5/8
 * Time: 15:54
 */

namespace App\Http\Classes;


use Illuminate\Support\Facades\DB;

class Level
{
    public static function getLevels($data){
        $level = DB::table('weibo_levels');
        if(isset($data['index']) && isset($data['limit'])){
            $level -> skip(($data['index'] - 1) * $data['limit']) -> take($data['limit']);
        }
        else{
            $level -> skip(1) -> take(20);
        }

        $level = $level -> get();

        if($level){
            return $level;
        }
        else{
            return null;
        }
    }
}